package com.thread.threadpool;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ThreadpoolExcutorDemo1 {

    static class MyTask implements Runnable {
        @Override
        public void run() {
            while (true) {
                System.out.println("im demo1 input");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public static void main(String[] args) {
        ThreadPoolExecutor executor = new ThreadPoolExecutor(1,5,100, TimeUnit.SECONDS,new LinkedBlockingDeque<Runnable>());
        executor.execute(new MyTask());
        executor.shutdown();
    }
}
